<!doctype html>
<html lang="en">
<head>
    @include('web.layout.head')
    <link rel="stylesheet" href="{{asset('/js/web/frame/jedate/skin/jedate.css')}}">
    <link rel="stylesheet" href="{{asset('/css/web/user/order_track.css')}}">
    <script src="{{asset('/js/web/frame/jedate/jquery.jedate.js')}}"></script>
    <script src="{{asset('/js/web/user/order_list.js')}}"></script>
</head>
<body>
@include('web.layout.header')
@include('web.layout.user_tab')
<div class="base_member_content">
    <div class="w1200">
        @include('web.layout.buyer_nav')
        <div class="nav_right flr">
            <div class="base_content">
                <div class="line_title">订单跟踪</div>
                <div class="order_state">
                    <ul class="order_finish">
                        <li class="order_first one">
                            <h3 class="submit">提交订单</h3>
                            <div class="spend">
                                <p class="quan">1</p>
                                <img class="quan1" src="{{asset('/img/web/user/dui.png')}}" alt="">
                                <img class="green" src="{{asset('/img/web/user/left.png')}}" alt="">
                            </div>
                            <h4 class="order_day order_day1">{{date('Y/m/d H:i', strtotime($order['order_at']))}}</h4>
                        </li>
                        <li class="order_first second">
                            <h3 class="submit">付款</h3>
                            <div class="spend">
                                <p class="quan">2</p>
                                @if($order['pay_at'])
                                    <img class="quan2"src="{{asset('/img/web/user/dui.png')}}" alt="">
                                    <img class="green_1"src="{{asset('/img/web/user/left.png')}}" alt="">
                                    <img class="green2"src="{{asset('/img/web/user/right.png')}}" alt="">
                                @endif
                            </div>
                            <h4 class="order_day order_day2">{{$order['pay_at'] ? date('Y/m/d H:i', strtotime($order['pay_at'])) : ''}}</h4>
                        </li>
                        <li class="order_first third">
                            <h3 class="submit">发货</h3>
                            <div class="spend">
                                <p class="quan">3</p>
                                @if($order['shipments_at'])
                                    <img class="quan3" src="{{asset('/img/web/user/dui.png')}}" alt="">
                                    <img class="green_2"src="{{asset('/img/web/user/left.png')}}" alt="">
                                    <img class="green4"src="{{asset('/img/web/user/right.png')}}" alt="">
                                @endif
                            </div>
                            <h4 class="order_day order_day3">{{$order['shipments_at'] ? date('Y/m/d H:i', strtotime($order['shipments_at'])) : ''}}</h4>
                        </li>
                        <li class="order_first fourth">
                            <h3 class="submit">完成</h3>
                            <div class="spend">
                                <p class="quan">4</p>
                                @if($order['confirm_at'])
                                    <img class="quan4" src="{{asset('/img/web/user/dui.png')}}" alt="">
                                    <img class="green3"src="{{asset('/img/web/user/right.png')}}" alt="">
                                @endif
                            </div>
                            <h4 class="order_day order_day4">{{$order['confirm_at'] ? date('Y/m/d H:i', strtotime($order['confirm_at'])) : ''}}</h4>
                        </li>
                    </ul>
                </div>
                <div class="order_details">
                    <div class="order_left">
                        <div class="order_title">订单详情</div>
                        <div class="order_number number">
                             <p class="order_num">订单编号：</p>
                            <span class="order_num1">{{$order['order_code']}}</span>
                        </div>
                         <div class="order_number">
                             <p class="order_num day">创建时间：</p>
                            <span class="order_num1">{{$order['created_at']}}</span>
                        </div>
                        <div class="order_number order_address">
                             <p class="order_num address">收货地址：</p>
                            <span class="order_num1">{{$order['address']}}</span>
                        </div>
                        <div class="order_number">
                             <p class="order_num store">商家信息：</p>
                            <span class="order_num1">{{array_get($order, 'shop.sp_name', '-')}}</span>
                        </div>
                        <div class="order_number">
                             <p class="order_num phone">联系电话：</p>
                            <span class="order_num1">
                                @if($order['order_type']==4)
                                    {{array_get($order, 'items_information.seller_phone', '-')}}
                                @else
                                    @if(array_get($order, 'company.company_material.contact_tel'))
                                        {{ltrim(array_get($order, 'company.company_material.contact_tel'),'-')}}
                                    @else
                                        {{array_get($order, 'company.company_material.contact_mobile')}}
                                    @endif
                                @endif
                            </span>
                        </div>
                    </div>
                    <div class="order_right">
                        <div class="right_status">
                            <p class="order_msg">订单状态：<span>{{array_get($order, 'order_status_name') ? : '-'}}</span></p>
                            <p class="order_logistics">物流：<span>{{array_get($express, 'express_company') ? : '-'}}</span></p>
                            <p class="order_logistics order_odd">运单号：<span>{{array_get($express, 'waybill_number') ? : '-'}}</span></p>
                            <p class="order_logistics logistics_follow">物流跟踪：</p>
                            @if(($result = array_get($express, 'result')) && $data = json_decode($result, 1))
                                @foreach($data as $item)
                                    <span class="order_arrive">{{$item['time']}} {{$item['context']}}</span>
                                @endforeach
                                <span class="order_arrive">{{$order['shipments_at']}} 卖家发货</span>
                            @else
                                <span class="order_arrive" style="margin-top:7px;">暂无物流信息</span>
                                {{--<span class="order_arrive">{{$order['shipments_at']}} 卖家发货</span>--}}
                            @endif
                        </div>
                    </div>
                </div>
                <div class="store_message">
                    <table>
                        <thead>
                            <tr class="product-message">
                                <td class = "product-name" width="340" height="32">订单商品</td>
                                <td class = "product-name" width="110" height="32">状态</td>
                                <td class = "product-name" width="108" height="32">单价</td>
                                <td class = "product-name" width="108" height="32">数量</td>
                                <td class = "product-name" width="130" height="32">
                                @if($order['order_type']==1 || $order['order_type']==6)
                                    优惠/运费
                                @else
                                    备注
                                @endif
                                </td>
                                <td class = "product-name" width="160" height="32">总价</td>
                            </tr>
                        </thead>
                        <tbody>
                        @if($order['order_type']==1 || $order['order_type']==6)
                            @foreach($order['order_products'] as $key => $order_product)
                            <tr class = "product-type">
                                <td class = "product-name" width="340" height="126">
                                    @if($order['order_type']==1)
                                    <a  class="img" target="_blank"  href="/product/info/{{$order_product['product_id']}}/{{$order_product['sku_id']}}">
                                        <img class="product-img" src="{{$order_product['product_img_url']}}" alt="">
                                    </a>
                                    <a  target="_blank"  href="/product/info/{{$order_product['product_id']}}/{{$order_product['sku_id']}}">
                                        <p class="product-explain">{{$order_product['product_name']}}</p>
                                    </a>
                                    @else
                                        <a  class="img">
                                            <img class="product-img" src="{{$order_product['product_img_url']}}" alt="">
                                        </a>
                                            <p class="product-explain">{{$order_product['product_name']}}</p>
                                    @endif
                                </td>
                                @if($key == 0)
                                    <td class = "product-name product-state" width="110" height="126" rowspan="{{$product_count = count($order['order_products'])}}">
                                        @if($order['order_status'] == 1)
                                       <font>等待付款</font>
                                       @elseif($order['order_status'] == 2)
                                       <font>等待发货</font>
                                       @elseif($order['order_status'] == 3)
                                       <font>已发货</font>
                                       @elseif($order['order_status'] == 4)
                                       <font>已确认收货</font>
                                       @elseif($order['order_status'] == 5)
                                       <font>订单已取消</font>
                                       @endif
                                        {{--待付款--}}
                                    </td>
                                @endif

                                <td class = "product-name" width="108" height="126">￥{{$order_product['product_price']}}</td>
                                <td class = "product-name" width="108" height="126">{{$order_product['quantity']}}</td>

                                @if($key == 0)
                                    <td class = "product-name" width="130" height="126" rowspan="{{$product_count}}">优惠：<i class="discount">￥{{$order['discount_money'] ? '-' . $order['discount_money'] : '0.00'}}</i><br>运费：￥{{$order['freight'] ?:'0.00'}}</td>
                                    <td class = "product-name product-price" width="160" height="126" rowspan="{{$product_count}}" style="color: red;">￥{{$order['order_money']}}</td>
                                @endif
                            </tr>
                            @endforeach
                        @elseif($order['order_type']==4)
                            {{--配单产品--}}
                            @foreach($order['items_products'] as $key => $items_product)
                            <tr class = "product-type">
                                <td class = "product-name" width="340" height="80">
                                    <p class="product-explain">{{$items_product['product_name']}} {{$items_product['model']}} {{$items_product['brand']}}</p>
                                </td>
                                @if($key == 0)
                                    <td class = "product-name product-state" width="110" height="80" rowspan="{{$product_count = count($order['items_products'])}}">
                                        @if($order['order_status'] == 1)
                                       <font>等待付款</font>
                                       @elseif($order['order_status'] == 2)
                                       <font>等待发货</font>
                                       @elseif($order['order_status'] == 3)
                                       <font>已发货</font>
                                       @elseif($order['order_status'] == 4)
                                       <font>已确认收货</font>
                                       @elseif($order['order_status'] == 5)
                                       <font>订单已取消</font>
                                       @endif
                                    </td>
                                @endif

                                <td class = "product-name" width="108" height="80">￥{{$items_product['price']}}</td>
                                <td class = "product-name" width="108" height="80">{{$items_product['num']}}</td>

                                @if($key == 0)
                                    <td class = "product-name" width="130" height="80" rowspan="{{$product_count}}">
                                        {{in_array(1,$order['items_information']['quote_contain'])?'含票税':''}}    {{in_array(2,$order['items_information']['quote_contain'])?'含运费':''}}    {{in_array(3,$order['items_information']['quote_contain'])?'含安装':''}}    {{in_array(4,$order['items_information']['quote_contain'])?'含公报总价':''}}
{{--                                        优惠：<i class="discount">￥{{$order['discount_money'] ? '-' . $order['discount_money'] : '0.00'}}</i><br>--}}
{{--                                        运费：￥{{$order['freight'] ?:'0.00'}}--}}
                                    </td>
                                    <td class = "product-name product-price" width="160" height="80" rowspan="{{$product_count}}" style="color: red;">￥{{$order['order_money']}}</td>
                                @endif
                            </tr>
                            @endforeach
                        @endif
                        </tbody>
                    </table>
                </div>
                <div class="invoice">
                    <h3 class="invoice_title">发票信息</h3>
                    <div class="invoice_left">
                        <p class="invoice_type">发票类型：<span>{{array_get($order['invoice'], 'invoice_type_name', '暂无发票信息')}}</span></p>
                        <p class="invoice_type">发票抬头：<span>{{array_get($order['invoice'], 'invoice_title', '-')}}</span></p>
                        <p class="invoice_type">发票税号：<span>{{array_get($order['invoice'], 'tax_code', '-')}}</span></p>
                        <p class="invoice_type">开户行：<span>{{array_get($order['invoice'], 'invoice_bank', '-')}}</span></p>
                        <p class="invoice_type">开户行账号：<span>{{array_get($order['invoice'], 'invoice_account', '-')}}</span></p>
                    </div>
                    <div class="invoice_right">
                        <p class="invoice_address">开票地址：<span>{{array_get($order['invoice'], 'post_address', '-')}}</span></p>
                        <p class="invoice_address">收票人姓名：<span>{{array_get($order['invoice'], 'post_contacts', '-')}}</span></p>
                        <p class="invoice_address">收票人手机：<span>{{array_get($order['invoice'], 'post_tel', '-')}}</span></p>
                        <p class="invoice_address">详细地址：<span>{{array_get($order['invoice'], 'post_address', '-')}}</span></p>
                    </div>
                </div>
               <div class="order_back">
                   <a href="{{asset('/member/buyer/orders')}}" class="order_back_btn">返回</a>
               </div>
                <div class="page">
                </div>
            </div>
        </div>
    </div>
</div>
@include('web.layout.footer')
<script type="text/javascript">
   
</script>
</body>
</html>